iT邦幫忙

2024 iThome 鐵人賽

DAY 9
1

昨天我們已經成功讓數字在現實與 ECMAScript 的世界中穿梭了,但那些咒語其實也被放在數字身上當成數字的名牌。

恩?聽不懂嗎?沒關係我講完我也不知道自己在說什麼,直接來看看範例!
image
經過前幾天的介紹,相信說明書裡這段應該大致上沒問題了吧!

但是!!!唯獨+0𝔽-0𝔽旁邊那個 𝔽 是啥??

這次就比較難找了,因為我還沒發現直接找到的方法,只能分享一下我如何找到的。

首先先找到之前有這個奇怪符號 𝔽 的地方點進去,因為我覺得跟數字旁邊那個符號應該有關。
info_2
接著往上滑一點就會看到到Mathematical Operations,來看看他寫了什麼吧!

Mathematical Operations

image
又是霹哩啪拉一大片...

一樣一個一個來:

This specification makes reference to these kinds of numeric values

--ECMAScript

「本規範中引用了這些類型的數值:」

Mathematical values: Arbitrary real numbers, used as the default numeric type.

--ECMAScript

「數學值:任意實數,用來做為預設的數字類型。」

Extended mathematical values: Mathematical values together with +∞ and -∞.

--ECMAScript

「擴展數學值:上面的數學值再加上正負無限大。」

Numbers: IEEE 754-2019 binary64 (double-precision floating point) values.

--ECMAScript

「Numbers:IEEE 754-2019 二進位64(雙精度浮點數)的值。」

BigInts: ECMAScript language values representing arbitrary integers in a one-to-one correspondence.

--ECMAScript

「BigInts:ECMAScript 中的值,任一整數有皆有對應的BigInt值。」

喔!看到這邊我們已經了解到 ECMAScript 中引用了這四種類型的數值!

In the language of this specification, numerical values are distinguished among different numeric kinds using subscript suffixes. The subscript 𝔽 refers to Numbers, and the subscript ℤ refers to BigInts.

--ECMAScript

「在這個規範中的語言,會使用下標來區分不同類型的數值。用下標 𝔽 表示Numbers,用下標 ℤ 表示BigInts。」

找到了!數字右下角有 𝔽 表示他是 ECMAScript 中的Numbers~繼續看下去吧!

Numeric values without a subscript suffix refer to mathematical values. This specification denotes most numeric values in base 10; it also uses numeric values of the form 0x followed by digits 0-9 or A-F as base-16 values.

--ECMAScript

「沒有下標的數字就是數學值。在規範中都是以十進位的數字為主。而他也會用0x這種形式,後面加上 0-9 或 A-F 來表示十六進位的數字」

既然已經找到答案了今天就先休息吧~

小結

今天帶大家探討了數字旁變的小符號究竟是什麼鬼東西,開頭講到了我覺得他很像名牌,在數字旁邊標上 𝔽 他就是Numbers;標上 ℤ 就是BigInts;沒有標他就是一般數學值。不知道各位有沒有一樣的感覺XDD

大家都怎麼查找規範呢?歡迎留言分享關於看規範的大小事~

參考資料
ECMAScript-Mathematical Operations


上一篇
[Day08]-在兩個不同宇宙之間切換的咒語?
下一篇
[Day10]-再靠近一點點,隨便你要幹嘛
系列文
如何詠唱JavaScript的Math咒語13
圖片
  直播研討會
圖片
{{ item.channelVendor }} {{ item.webinarstarted }} |
{{ formatDate(item.duration) }}
直播中

2 則留言

0
Chris
iT邦新手 4 級 ‧ 2024-09-23 09:23:15

原來是註解

0
Chris
iT邦新手 4 級 ‧ 2024-09-23 09:23:16

原來是註解

我要留言

立即登入留言